package com.yanrumiao.entity;

import cc.uncarbon.framework.core.enums.EnabledStatusEnum;
import cc.uncarbon.framework.crud.entity.HelioBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;

import java.io.Serial;
import java.time.LocalDateTime;


/**
 * 优惠券信息
 */
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "coupon")
public class CouponEntity extends HelioBaseEntity<Long> {

    @Serial
    private static final long serialVersionUID = 1L;


    @Schema(description = "优惠券名称")
    @TableField(value = "name")
    private String name;

    @Schema(description = "优惠券类型：0=代金券、1=折扣券、2=满减券")
    @TableField(value = "type")
    private Integer type;

    @Schema(description = "每人可领取的数量限制")
    @TableField(value = "limit_per_person")
    private Integer limitPerPerson;

    @Schema(description = "优惠金额（分），对于代金券和满减券表示减免金额，对于折扣券可表示折扣比例的分母（如80表示8折）")
    @TableField(value = "amount")
    private Integer amount;

    @Schema(description = "满减券使用时需要满足的最低消费金额（分）, 对于代金券和折扣券此字段可设为0")
    @TableField(value = "min_spend")
    private Integer minSpend;

    @Schema(description = "优惠券总发行数量")
    @TableField(value = "total_quantity")
    private Integer totalQuantity;

    @Schema(description = "已使用的优惠券数量")
    @TableField(value = "residue_quantity")
    private Integer residueQuantity;

    @Schema(description = "优惠券生效开始时间")
    @TableField(value = "start_time")
    private LocalDateTime startTime;

    @Schema(description = "优惠券失效结束时间")
    @TableField(value = "end_time")
    private LocalDateTime endTime;

    @Schema(description = "优惠券状态：0=禁用，1=启用")
    @TableField(value = "status")
    private EnabledStatusEnum status;

    @Schema(description = "所属店铺ID")
    @TableField(value = "store_id")
    private Integer storeId;

}
